<?php
if(isset($_GET['addr_id'])&& !empty($_GET['addr_id'])) {
    echo get_template_header_info($_GET['addr_id'], 'village');
}
?>
<div class="hp-tab-newprd">
    <?php if(!empty($_GET['farmer_id'])){?>
        <img style="margin-left: 75px;" src="<?php echo base_path()?>sites/all/themes/tweme/images/images/farmer.png"/>
    <?php }else if(!empty($_GET['addr_id'])){ ?>
        <img style="margin-left: 75px;" src="<?php echo base_path()?>sites/all/themes/tweme/images/images/village.png"/>
    <?php }?>
    <ul class="j-sw-nav">
    <?php if (arg(2) == "edit" && !isset($_GET['addr_id'])&&empty($_GET['addr_id'])) { ?>
            <li class="newprd-s1 tab-li"><a href="<?php echo base_path(); ?>village/activity/list">查看</a></li>
            <?php if(user_access('add village_activity')){?>
            <li class="newprd-s2 tab-li"><a href="<?php echo base_path(); ?>village/activity/add">添加</a></li>
            <?php }?>
            <li class="newprd-s3 tab-li on"><a href="javascript:void(0)">修改</a></li>
    <?php } else if((arg(2) == "add" && !empty($_GET['addr_id'])) || (arg(2) == "edit" && !empty($_GET['addr_id']))){ ?>
        <?php echo get_tab($_GET['addr_id'],'activity','village'); ?>
    <?php } else if(arg(2) == 'add' && empty($_GET['addr_id'])){ ?>
            <li class="newprd-s1 tab-li"><a href="<?php echo base_path(); ?>village/activity/list">查看</a></li>
        <?php if(user_access('add village_activity')){?>
            <li class="newprd-s2 tab-li on"><a href="<?php echo base_path(); ?>village/activity/add">添加</a></li>
        <?php }?>
    <?php } ?>
    </ul>
    <div class="table-div" >
        <div class="small-select small-input column" style="clear:both">
            <?php  print _address_render_for_add($form)?>
        </div>
        <div class="small-select small-input column" style="clear:both">
            <div class="form-label">活动日期:</div><?php print render($form['date']); ?>
        </div>
        <div class="max-select big-input column" style="clear:both">
            <?php if( empty($_GET['distributor_id'])) { ?>
                <div class="max-big-input address-search">
                    <div class="form-label"><span class="required">*</span>请选经销商:</div>
                    <?php print render($form['distributor_name']);
                    print render($form['select_distributor_button']);
                    ?>
                </div>
            <?php  } ?>
        </div>
<!--        <div class="small-select small-input column" style="clear:both">-->
<!--            <div class="small-div"><div class="form-label">经销商姓名:</div>--><?php //print render($form['distributor']); ?><!--</div>-->
<!--        </div>-->
        <div class="small-select max-big-input column" style="clear:both">
            <div >
                <div class="form-label"><span class="required">*</span>标题:
                </div>
                <?php print render($form['title']); ?>
            </div>
        </div>
        <div class="small-select max-big-input column" style="clear:both">
            <div class="form-label">专项活动:</div><?php print render($form['special_activities']); ?>
        </div>
        <div  style="clear:both">
            <div class="form-label"><span class="required">*</span>活动内容:</div><div style="margin-left: 11.3em; "><?php print render($form['body']); ?></div>
        </div>
        <div  style="clear:both">
            <div class="form-label">参与人员:</div><div style="margin-left: 11.3em; "><?php print render($form['attendee']); ?></div>
        </div>
        <div  style="clear:both">
            <div class="form-label">其他信息:</div><div style="margin-left: 11.3em; "><?php print render($form['comments']); ?></div>
        </div>
        <div class="add-submit" style="text-align: center"><?php print render($form['submit']); ?></div>
        <?php if(isset($_GET['addr_id'])&& !empty($_GET['addr_id'])){?>
            <ul class="table-ul-li">
                <li style=" padding: 2em 0; float: right; margin-top: -5.8em;margin-right: 24em;"><a href="<?php echo base_path(); ?>village/activity/list?addr_id=<?php echo $_GET['addr_id']?>">
                        <input class="btn btn-primary form-submit" type="button"  value="返回">
                    </a></li>
<!--                <li>|</li>-->
<!--                <li><a href="--><?php //echo base_path(); ?><!--village/activity/add?addr_id=--><?php //echo $_GET['addr_id']?><!--" --><?php //if(arg(2) == 'add' && !empty($_GET['addr_id'])){ ?><!--class="selected"--><?php //}?><!--添加</a></li>-->
<!--                --><?php //if(arg(2) == "edit" && !empty($_GET['addr_id'])){?>
<!--                    <li>|</li>-->
<!--                    <li class="selected">详情</li>-->
<!--                --><?php //}?>
            </ul>
        <?php }?>
        <div style="clear: both"></div>
    </div>
</div>


<?php print drupal_render_children($form); ?>
</div></form>
<div>
    <div class="modal fade" id="distributorModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close"
                            data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        选择经销商
                    </h4>
                </div>
                <div class="modal-body">
                    <?php echo @render(drupal_get_form('distributor_select_list_form'),$_GET['addr_id']?$_GET['addr_id']:'');?>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>

                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
</div>
<form><div>